<?php
	$db = new PDO("pgsql:host=localhost;dbname=postgres", "myuser", "mypass");
	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

	$namesQuery = $db->prepare("SELECT * FROM TASKS"); 
	$namesQuery->execute();
	
	while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)) {
      $data = $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
      print $data;
    }
	
	
	$result = $namesQuery->fetchAll();

	var_dump($result);